Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fuzzing test on Base64 encoding and decoding #486

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

paul-leydier
Copy link
Contributor

As discussed in #480 , with the new Go version (1.18), we can now start adding Fuzzing tests to some of our algorithms.

This is my first try at this feature, so I would like your opinion on the code, and wheen it'll look good to you, I can work on implementing fuzzing tests on other algorithms.

To run this fuzzing test:

cd conversion
go test -fuzz FuzzBase64Encode

It'll run indefinitely by default, you can stop it with ctrl+c.

Example output:

fuzz: elapsed: 0s, gathering baseline coverage: 0/15 completed
fuzz: elapsed: 0s, gathering baseline coverage: 15/15 completed, now fuzzing with 12 workers
fuzz: elapsed: 3s, execs: 445059 (148282/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 6s, execs: 946614 (167085/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 9s, execs: 1453798 (168859/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 12s, execs: 1960814 (168923/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 15s, execs: 2468164 (168982/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 18s, execs: 2972295 (168527/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 21s, execs: 3478535 (168796/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 24s, execs: 3982537 (168027/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 27s, execs: 4487069 (168199/sec), new interesting: 0 (total: 14)
fuzz: elapsed: 28s, execs: 4647720 (153165/sec), new interesting: 0 (total: 14)
PASS
ok      github.com/TheAlgorithms/Go/conversion  28.614s

Copy link
Member

@tjgurwara99 tjgurwara99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

On a similar but separate note, have you noticed any speed issues with Fuzzing?

@tjgurwara99 tjgurwara99 enabled auto-merge (squash) March 28, 2022 21:52
@tjgurwara99 tjgurwara99 merged commit f15028b into TheAlgorithms:master Mar 29, 2022
@paul-leydier
Copy link
Contributor Author

LGTM

On a similar but separate note, have you noticed any speed issues with Fuzzing?

Well, I am not sure what speed should be expected as I am not used to using fuzzing, but as you can see on the logs in my pull request message, everything seemed to be running quite fast.

On the other hand, I was experiencing a few seconds delay when launching the command go test -fuzz FuzzBase64Encode. Is this what you are refering to?

@tjgurwara99
Copy link
Member

On the other hand, I was experiencing a few seconds delay when launching the command go test -fuzz FuzzBase64Encode. Is this what you are refering to?

Yeah, I was working on the Fuzzing on the beta release and it had a delay - I hoped that it would've been fixed in the public release candidate, but oh well 🤷🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants